<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      a {
        text-decoration: none;
      }
      .menu__link {
        line-height: 2;
        position: relative;
      }
      .menu__link::before {
        content: "";
        width: 0;
        height: 2px;
        border-radius: 2px;
        background-color: red;
        position: absolute;
        bottom: -0.25rem;
        right: 0;
        transition: right 0.4s, width 0.4s, left 0.4s;
      }
      .menu__link:hover::before {
        width: 100%;
        left: 0;
      }
    </style>
  </head>
  <body>
    <a href="#" class="menu__link">首页</a>
  </body>
</html>
